<template>
	<view class="content">
		<view class="info">
			<view class="info1">
				<text>姓名</text>
				<input type="text" v-model="name" value="" placeholder="请输入姓名" placeholder-class="inputStyle" />
			</view>
			<view class="info1">
				<text>电话</text>
				<input
					type="number"
					v-model="phn"
					value=""
					placeholder="请输入联系电话"
					placeholder-class="inputStyle"
				/>
			</view>
			<view class="info1" @click="getMap">
				<text>地点</text>
				<input
					type="text"
					v-model="location"
					value=""
					disabled
					placeholder="请输入还车地点"
					placeholder-class="inputStyle"
				/>
			</view>
			<u-picker v-model="show" mode="time" :params="params" @confirm="confirm"></u-picker>
			<view class="info1" @click="this.show = true">
				<text>时间</text>
				<input type="number" v-model="tm" value="" placeholder="还车时间" placeholder-class="inputStyle" disabled />
			</view>
		</view>

		<view class="confirmUpload" @click="confirmUp">确认还车</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			params: {
				year: true,
				month: true,
				day: true,
				hour: true,
				minute: true,
				second: true
			},
			show: false,
			location: '', // 地点
			tm: '', // 时间
			oid: '',
			name: '',
			phn: ''
		};
	},
	onLoad(e) {
		this.oid = e.oid;
	},
	methods: {
		async getMap() {
			
			
			
			const res = await uni.chooseLocation();
			if (res) {
				this.location = res[1].address;
			}
			
			
			
			console.log('res', res);
		},

		confirm(e) {
			this.show = false;

			this.tm = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
			console.log('this.tm :>> ', this.tm);
		},
		async confirmUp() {
			let arr = [this.location, this.tm, this.name, this.phn];
			arr.forEach(e => {
				if (!e) {
					return uni.$showMsg('不能为空');
				}
			});

			const res = await this.$u.post('api/car/car_also', {
				uid: uni.getStorageSync('uid'),
				oid: this.oid,
				car_also: this.location,
				time_also: this.tm,
				name: this.name,
				phone: this.phn
			});
			uni.navigateBack({
				delta: 1
			});
			uni.$showMsg(res.msg);
			console.log('res >>  ', res);
		}
	}
};
</script>

<style lang="scss" scoped>
.content {
	width: 100vw;
	height: 100vh;
	overflow: scroll;
	padding: 30rpx;
	.info {
		width: 690rpx;
		//height: 689rpx;
		background: #2a2929;
		box-shadow: 0rpx 0rpx 18rpx 0rpx rgba(51, 51, 51, 0.1);
		border-radius: 20rpx;
		padding: 25rpx 31rpx 31rpx 31rpx;
		margin: 0 auto;

		.info1 {
			display: flex;
			flex-direction: column;
			justify-content: center;
			height: 131rpx;
			// margin-left: 29rpx;
			border-bottom: 2rpx solid #f1eded;

			text {
				font-size: 36rpx;
				font-family: 'Microsoft YaHei', PingFang SC;
				font-weight: 400;
				color: #ffffff;
			}

			text:before {
				content: '*';
				color: #ff0000;
			}

			.inputStyle {
				font-size: 30rpx;
				font-family: 'Microsoft YaHei', PingFang SC;
				font-weight: 400;
				color: #ffffff;
			}
			input {
				color: #ffffff;
				padding-left: 10rpx;
			}
		}
	}

	.idCrd {
		width: 690rpx;
		//height: 300rpx;
		background: #2a2929;
		border-radius: 20rpx;
		padding: 30rpx;
		margin-top: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.ddd {
			display: flex;
			//justify-content: flex-start;
			flex-wrap: wrap;
			//padding: 0  30rpx;
			image {
				width: 100%;
				height: 100%;
			}
			.image {
				width: 250rpx;
				height: 180rpx;
				border: 1rpx dashed #606266;
				border-radius: 10rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-left: 40rpx;
				margin-bottom: 20rpx;
			}
		}

		text {
			height: 34rpx;
			line-height: 34rpx;
			font-size: 36rpx;
			font-family: 'Microsoft YaHei', PingFang SC;
			font-weight: 400;
			color: #ffffff;
		}

		text:before {
			content: '*';
			color: #ff0000;
		}
		/deep/ .u-list-item {
			background: none !important;
			border: 1rpx dashed #606266;
			margin-right: 30rpx !important;
		}
		/deep/ .u-upload {
			// display: flex !important;
			// justify-content: space-between !important;
		}
	}
	.confirmUpload {
		margin: 0 auto;
		margin-top: 99rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 690rpx;
		height: 100rpx;
		background: #d60000;
		border-radius: 50rpx;

		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #ffffff;
	}
}
</style>
